package chapter02;

/**
 * for循环输出菱形
 * Created by a on 2017/6/9.
 */
public class Test037 {
    public static void main(String[] args) {
        priHollowRhombus(10);

    }

    public static void priHollowRhombus(int size){
        if (size%2==0){
            size++;
        }
        for (int i =0;i<size/2+1;i++){
            for (int j = size/2+1;j>i+1;j--){
                System.out.println(" ");
            }
            for (int j = 0;j<2*i+1;j++){
                if (j==0||j ==2*i){
                    System.out.println("*");
                }else {
                    System.out.println(" ");
                }
            }
            System.out.println(" ");
        }
        for (int i = size/2+1;i<size;i++){
            for (int j = 0;j<i-size/2;j++){
                System.out.println(" ");
            }
            for (int j =0; j<2*size-1-2*i;j++){
                if (j==0||j==2*(size-i-1)){
                    System.out.println("*");
                }else {
                    System.out.println(" ");
                }
            }
            System.out.println(" ");
        }
    }
}
